package com.arlin.springcloud.service;

import com.arlin.springcloud.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @ClassName: DeptClientService
 * @Description: TODO
 * @Author: arlin
 * @Date: 2021/3/22
 */
@Component  //service注入
@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT", fallbackFactory = DeptClientServiceFallbackFactory.class)   //通过服务名查找，进行绑定
public interface DeptClientService {

    @PostMapping("/dept/add")
    boolean addDept(Dept dept);

    @GetMapping("/dept/get/{id}")
    Dept get(@PathVariable("id")  Long id);

    @GetMapping("/dept/list")
    List<Dept> getAll();

}
